import pymysql
import random
import time
import multiprocessing
import math


def hello(x):
    x = str(x)
    print("hello {0}".format(x))
    time.sleep(5)


if __name__ == "__main__":
    multiprocessing.freeze_support()
    start_time = time.clock()
    result = multiprocessing.Process(target=hello, args=(1,))
    result.start()
    two = multiprocessing.Process(target=hello, args=(2,))
    two.start()

    time.sleep(5)
    end_time = time.clock()
    print("共用：{0}ms".format(math.ceil((end_time - start_time) * 1000)))
